//********************************************************************************************
//
// File : icmp.h implement for Internet Control Message Protocol
//
//********************************************************************************************
//
// Copyright (C) 2007
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
// This program is distributed in the hope that it will be useful, but
//
// WITHOUT ANY WARRANTY;
//
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 51
// Franklin St, Fifth Floor, Boston, MA 02110, USA
//
// http://www.gnu.de/gpl-ger.html
//
//********************************************************************************************
#ifndef __ICMP_h__
#define __ICMP_h__

#include "BasicTypes.h"

class cIcmp
{
public:
    static const U8 ICMP_TYPE_ECHOREPLY_V   = 0;
    static const U8 ICMP_TYPE_ECHOREQUEST_V = 8;
    static const U8 ICMP_PACKET_LEN         = 40;

// icmp buffer position
    static const U8 ICMP_TYPE_P             = 0x22;
    static const U8 ICMP_CODE_P             = 0x23;
    static const U8 ICMP_CHECKSUM_H_P       = 0x24;
    static const U8 ICMP_CHECKSUM_L_P       = 0x25;
    static const U8 ICMP_IDENTIFIER_H_P     = 0x26;
    static const U8 ICMP_IDENTIFIER_L_P     = 0x27;
    static const U8 ICMP_SEQUENCE_H_P       = 0x28;
    static const U8 ICMP_SEQUENCE_L_P       = 0x29;
    static const U8 ICMP_DATA_P             = 0x2A;


    //variable
private:
    static U8 icmp_id;
    static U8 icmp_seq;

//********************************************************************************************
//
// Prototype function
//
//********************************************************************************************

public:
    static U8 SendReply ( U8 *pBuff, U8 *pDestMac, U8 *pDestIP );
private:
    static void GenerateICMPPacket ( U8 *pBuff );

};

#endif

